<template>
  <div class="ma-content-block lg:flex justify-between p-4">
    <!-- CRUD 组件 -->
    <ma-crud :options="options" :columns="columns" ref="crudRef">
    </ma-crud>
    <add-modal-form ref="addModalMormRef"></add-modal-form>
    <info-modal-form ref="infoModalMormRef"></info-modal-form>
  </div>
</template>
<script setup>
import { ref, reactive } from 'vue'
import shipmentThirdFedex from '@/api/document/shipmentThirdFedex'
import { Message } from '@arco-design/web-vue'
import tool from '@/utils/tool'
import * as common from '@/utils/common'
import dictHelp from "@/utils/dicthelp.js";
import AddModalForm from "./add2.vue";
import InfoModalForm from "./info2.vue";
const crudRef = ref()
const addModalMormRef = ref()
const infoModalMormRef = ref()
const options = reactive({
  id: 'shipment_third_fedex',
  rowSelection: {
    showCheckedAll: true
  },
  pk: 'id',
  operationColumn: true,
  operationColumnWidth: 160,
  formOption: {
    viewType: 'drawer',
    width: '70%',
  },
  api: shipmentThirdFedex.getList,
  add: {
    show: true,
    api: shipmentThirdFedex.save,
    auth: ['document:shipmentThirdFedex:save'],
    action :()=> {
      addModalMormRef.value.onShow()
    }
  },
  edit: {
    show: true,
    api: shipmentThirdFedex.update,
    auth: ['document:shipmentThirdFedex:update'],
    action :(record)=> {
      infoModalMormRef.value.onShow(record)
    }
  },
  delete: {
    show: true,
    api: shipmentThirdFedex.deletes,
    auth: ['document:shipmentThirdFedex:delete']
  }
})

const columns = reactive([
  {
    title: "主键",
    dataIndex: "id",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    commonRules: {
      required: true,
      message: "请输入主键"
    }
  },
  {
    title: "更新者",
    dataIndex: "updated_by",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },

  {
    title: "更新时间",
    dataIndex: "updated_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "删除时间",
    dataIndex: "deleted_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "备注",
    dataIndex: "remark",
    formType: "input",
    addDisplay: false,
    hide: true
  },
  {
    title: "站点",
    dataIndex: "depot_id",
    formType: "select",
    dict:dictHelp.depotSea,
    editDisplay: false,
    commonRules: {
      required: true,
      message: "请选择站点"
    }
  },
  {
    title: "州/省",
    dataIndex: "state",
    formType: "input",
    editDisplay: false,
    commonRules: {
      required: true,
      message: "请填写州/省"
    }
  },
  {
    title: "城市",
    dataIndex: "city",
    formType: "input",
    editDisplay: false,
    commonRules: {
      required: true,
      message: "请输入城市"
    }
  },
  {
    title: "街道",
    dataIndex: "street",
    formType: "input",
    editDisplay: false,
    commonRules: {
      required: true,
      message: "请输入街道"
    }
  },
  {
    title: "邮编",
    dataIndex: "postcode",
    formType: "input",
    editDisplay: false,
    commonRules: {
      required: true,
      message: "请输入邮编"
    }
  },
  {
    title: "时间",
    dataIndex: "time",
    formType: "date",
    editDisplay: false,
    commonRules: {
      required: true,
      message: "请选择时间"
    }
  },
  {
    title: "创建者",
    dataIndex: "created_by",
    formType: "select",
    dict:dictHelp.user,
    addDisplay: false,
    editDisplay: false,
  },
  {
    title: "创建时间",
    dataIndex: "created_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    showTime: true
  },
])
</script>
<script> export default { name: 'document:shipmentThirdFedex' } </script>